package view;

import java.awt.Point;

import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import model.Set;

/**
 * Main class of the view
 * @author Adrien Ledeul
 * @version 0.1
 */
public class Main
{
	private static FormWindow form;
	private static MonitorWindow monitor;
	
	private static Set set;

	/**
	 * Main function
	 * @param args arguments list
	 */
	public static void main (String[] args) 
	{	
        try
        {
        	
        	try 
        	{
        	    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        	        if ("Nimbus".equals(info.getName())) {
        	            UIManager.setLookAndFeel(info.getClassName());
        	            break;
        	        }
        	    }
        	} 
        	catch (Exception e) 
        	{
        		UIManager.setLookAndFeel ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        	}
        }
        catch (Exception e)
        {}

        try
        {
        	set =  new Set();
        	
        	form = new FormWindow(set);
        	form.setLocation(new Point(5,5));
            form.setVisible(true); 
        	monitor = new MonitorWindow(set);
        	monitor.setLocation(new Point(300,5));
        	monitor.setVisible(true); 
        }
        catch (java.lang.OutOfMemoryError oome)
        {
            JOptionPane.showMessageDialog(null, "Internal Error : Out of Memory", "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
}
